<%
Set nameRS = objConn.Execute("SELECT PG_NAME FROM TB_PAGES WHERE PG_ID = "&testSQLinj(request.QueryString("idpage")))
if not nameRS.EOF then
	nomepagina = nameRS("PG_NAME")
end if
Set nameRS = Nothing
SQL = "SELECT * FROM TB_ARTICLES WHERE ID_ARTICOLO = (SELECT PG_ID_ARTICLE FROM TB_PAGES WHERE PG_ID = "&testSQLinj(request.QueryString("idpage"))&")"
Set tag = objConn.Execute(SQL)
if not tag.EOF then
	With response
	.Write "<b style=""float:left"">" & tag("NOME_ARTICOLO") & "<br /> &raquo; "& nomepagina &"</b>"
	.Write "<select class='inputclass' id=""sel"" style=""float:right"" name='sel'>"
	.Write "<optgroup style=""text-align:left"" label="""&tag("NOME_ARTICOLO")&""">"
  	Set pag = objConn.Execute("SELECT * FROM TB_PAGES WHERE PG_ID_ARTICLE = " & tag("ID_ARTICOLO") & " ORDER BY PG_ID")
	Do while not pag.EOF
	%>
	<option value="<%=pag("PG_ID")%>" <%call selected(testSQLinj(request.QueryString("idpage")), pag("PG_ID"))%>><%=pag("PG_NAME")%></option>
	<%
	pag.MoveNext
  	Loop	
	.Write "</optgroup></select><br style=""clear:both""/>"&vbNewLine
End with
end if
%>
<script language="javascript" type="text/javascript">
//Funzione per la gestione dei blocchi
$j(document).ready(function(){
 
 $j("select#sel").change(function(){
 	location.href = 'default.asp?modulo=pages&amp;idpage='.replace("&amp;", "&") + this.options[this.selectedIndex].value;
 });
 
});

</script>